#pragma config(Hubs,  S1, HTMotor,  HTMotor,  HTServo,  none)
#pragma config(Hubs,  S4, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Sensor, S2,     ir,             sensorHiTechnicIRSeeker1200)
#pragma config(Sensor, S3,     sonar,          sensorSONAR)
#pragma config(Sensor, S4,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     frontLeft,     tmotorTetrix, openLoop, encoder)
#pragma config(Motor,  mtr_S1_C1_2,     rearLeft,      tmotorTetrix, openLoop, encoder)
#pragma config(Motor,  mtr_S1_C2_1,     harvester,     tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_2,     arm,           tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C1_1,     rearRight,     tmotorTetrix, openLoop, reversed, encoder)
#pragma config(Motor,  mtr_S4_C1_2,     frontRight,    tmotorTetrix, openLoop, reversed, encoder)
#pragma config(Motor,  mtr_S4_C2_1,     lift,          tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S4_C2_2,     motorK,        tmotorTetrix, openLoop)
#pragma config(Servo,  srvo_S1_C3_1,    guiderDrop,           tServoStandard)
#pragma config(Servo,  srvo_S1_C3_2,    leftHook,             tServoStandard)
#pragma config(Servo,  srvo_S1_C3_3,    rightHook,            tServoStandard)
#pragma config(Servo,  srvo_S1_C3_4,    pivot,                tServoStandard)
#pragma config(Servo,  srvo_S1_C3_5,    doors,                tServoStandard)
#pragma config(Servo,  srvo_S1_C3_6,    servo6,               tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include <JoystickDriver.c>
#include "Cascade_Functions.h"

task main()
{
	phase = AUTO;
	//int goal = 1;
	driveCycles = 4;
	humor = 100;
	bDisplayDiagnostics = false;
	initializeAutonomous();
	bDisplayDiagnostics = true;
	waitForStart();
	//motor [lift] = 100;
	//drive(0, -100, 0);
	//wait1Msec(750);
	//motor [lift] = 0;
	while (nMotorEncoder [frontRight] > -(driveCycles * driveEncoderCycle))
	{
		drive(0, -100, 0);
	}
	allStop();
	//ClearTimer(T1);
	//while (SensorValue [sonar] > 20)
	//{
	//	drive(0, 0, -50);
	//	if (time1[T1] > 2000)
	//	{
	//		break;
	//		goal = 0;
	//	}
	//}
	//if (!goal)
	//{
	//	while (SensorValue [sonar] > 28)
	//	{
	//		drive(0, 0, -50);
	//	}
	//}
	//wait1Msec(350);
	//allStop();
	//drive(0, -100, 0);
	//wait1Msec(100);
	//allStop();
	wait1Msec(50);
	servo [leftHook] = 168;
	servo [rightHook] = 16;
	wait1Msec(50);
	drive(0, 0, -100);
	wait1Msec(225);
	drive(100, 0, 0);
	drive(0, 100, 0);
	wait1Msec(1700);
	allStop();
}
